Clean up the scroll support a little
authorRichard Hult <richard@imendio.com>
Fri, 16 Jan 2009 18:47:16 +0000 (19:47 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:15:24 +0000 (10:15 +0200)
gdk/quartz/gdkevents-quartz.c

index bbd1e7d3494b34434e0ac150561b2b62c9b01f27..1a66a31b6933ba533b77da88172039596071872a 100644 (file)
@@ -1807,31 +1807,25 @@ gdk_event_translate (GdkEvent *event,
        float dy = [nsevent deltaY];
        GdkScrollDirection direction;
 
-       /* The delta is how much the mouse wheel has moved. Since there's no such thing in GTK+
-        * we accomodate by sending a different number of scroll wheel events.
-        */
-
-       /* First do y events */
-       if (dy < 0.0)
-         {
-           dy = -dy;
-           direction = GDK_SCROLL_DOWN;
-         }
-       else
-         direction = GDK_SCROLL_UP;
+        if (dy != 0)
+          {
+            if (dy < 0.0)
+              direction = GDK_SCROLL_DOWN;
+            else
+              direction = GDK_SCROLL_UP;
 
-        fill_scroll_event (window, event, nsevent, direction);
+            fill_scroll_event (window, event, nsevent, x, y, direction);
+          }
 
-       /* Now do x events */
-       if (dx < 0.0)
-         {
-           dx = -dx;
-           direction = GDK_SCROLL_RIGHT;
-         }
-       else
-         direction = GDK_SCROLL_LEFT;
+        if (dx != 0)
+          {
+            if (dx < 0.0)
+              direction = GDK_SCROLL_RIGHT;
+            else
+              direction = GDK_SCROLL_LEFT;
 
-        fill_scroll_event (window, event, nsevent, direction);
+            fill_scroll_event (window, event, nsevent, x, y, direction);
+          }
       }
       break;